from sqlalchemy.orm import Session
from passlib.apps import custom_app_context as pwd_context
from elasticsearch import Elasticsearch

from common import models, schemas,logger

log=logger.tlog()
logger=log.define()



def get_baseinfo(db: Session, report: schemas.Report):
    cursor = db.execute('select pid,company_name as \'公司名称(英文)\' ,company_local_name as \'公司名称(本地)\'  ,country_iso_code as \'国家ISO代码\',city as \'城市\'\
         from cafrica.company_base_information where pid = :pid', params={"pid": report.pid})
    #cursor = db.execute('select bid, company_name from tht.contact_information where bid =:bid', params={"bid": 'CN9360812942'})
    res_rows = cursor.fetchall()
    #转换字典
    result = [dict(zip(result.keys(), result)) for result in res_rows]

    return result